//
//  GQAreaInfo.m
//  GuQu
//
//  Created by HELIUM STAR on 15/5/19.
//  Copyright (c) 2015年 HELIUM STAR. All rights reserved.
//

#import "GQAreaInfo.h"
#import "GQCitiesInfo.h"

@implementation GQAreaInfo

- (instancetype)initWithDict:(NSDictionary *)dict
{
    if (self = [super init]) {
        [self setValuesForKeysWithDictionary:dict];
    }
    return self;
}

+ (instancetype)areaInfoWithDict:(NSDictionary *)dict
{
    return [[self alloc] initWithDict:dict];
}

+ (NSArray *)areaInfoWithDict
{
    NSString *filePath = [[NSBundle mainBundle] pathForResource:@"area" ofType:@"plist"];
    NSArray *areaInfoPlist = [NSArray arrayWithContentsOfFile:filePath];
    NSMutableArray *areaInfoM = [NSMutableArray array];
    for (NSDictionary *dict in areaInfoPlist) {
        GQAreaInfo *areaInfo = [GQAreaInfo areaInfoWithDict:dict];
        NSMutableArray *infoM = [NSMutableArray array];
        for (NSDictionary *dict1 in areaInfo.cities) {
            GQCitiesInfo *citiesInfo = [GQCitiesInfo areaInfoWithDict:dict1];
            [infoM addObject:citiesInfo];
        }
        areaInfo.cities = infoM;
        [areaInfoM addObject:areaInfo];
    }
    return areaInfoM;
}

@end
